# -*- coding: utf-8 -*-
"""
Module Description: 角色数据库模型
"""
import peewee
import datetime
from framework.dal.models import BaseCharacterModel


class TbOrderSend(BaseCharacterModel):
    OrderId = peewee.CharField(max_length=32, primary_key=True)
    RoleGuid = peewee.CharField(max_length=32)
    GameId = peewee.IntegerField()
    ServerType = peewee.IntegerField()
    OrderType = peewee.IntegerField()
    Price = peewee.IntegerField()
    NeedTime = peewee.IntegerField()
    SafePrice = peewee.IntegerField()
    QuickPrice = peewee.IntegerField()
    GameNickName = peewee.CharField(max_length=96, default='')
    GameDes = peewee.CharField(max_length=200, default='')
    GameAccount = peewee.CharField(max_length=13, default='')
    Mobile = peewee.CharField(max_length=11, default='')
    GamePassword = peewee.CharField(max_length=20, default='')
    Title = peewee.CharField(max_length=255, default='')
    ServerId = peewee.IntegerField(default=0)
    CreateTime = peewee.DateTimeField(default="2010-01-01 00:00:00")


class TbRole(BaseCharacterModel):
    RoleGuid = peewee.CharField(max_length=32, primary_key=True)
    AffairId = peewee.CharField(max_length=32)
    ServiceAffairId = peewee.CharField(max_length=32)
    Sex = peewee.IntegerField(default=0)
    NickName = peewee.CharField(max_length=96, default='')
    RoleLv = peewee.IntegerField(default=1)
    RoleExp = peewee.IntegerField(default=0)
    Mobile = peewee.CharField(max_length=11)
    Head = peewee.CharField(max_length=255)
    UserStatus = peewee.IntegerField(default=1)
    MatchTimes = peewee.IntegerField(default=0)
    Account = peewee.CharField(max_length=32)
    Password = peewee.CharField(max_length=32)
    IsService = peewee.IntegerField(default=0)
    LastEnterTime = peewee.DateTimeField(default="2010-01-01 00:00:00")
    ServiceTimes = peewee.IntegerField(default=0)
    ServiceTime = peewee.IntegerField(default=0)
    Amount = peewee.IntegerField(default=0)
    ServiceLv = peewee.IntegerField(default=0)
    GameServerDict = peewee.CharField(max_length=1000, default='{}')
    CreateTime = peewee.DateTimeField(default="2010-01-01 00:00:00")


class TbRoleAffair(BaseCharacterModel):
    AffairId = peewee.CharField(max_length=32, primary_key=True)
    RoleGuid = peewee.CharField(max_length=32)
    ServiceRoleGuid = peewee.CharField(max_length=32)
    SeatId = peewee.IntegerField(default=0)
    FavoriteLv = peewee.IntegerField(default=0)
    AffairStatus = peewee.IntegerField(default=0)
    Content = peewee.CharField(max_length=3000, default="")
    EndTime = peewee.DateTimeField(default="2010-01-01 00:00:00")
    CreateTime = peewee.DateTimeField(default="2010-01-01 00:00:00")


class TbServiceRoleAffair(BaseCharacterModel):
    AffairId = peewee.CharField(max_length=32, primary_key=True)
    RoleGuid = peewee.CharField(max_length=32)
    ServiceRoleList = peewee.CharField(max_length=800, default='[]')
    LockSeatId = peewee.IntegerField(default=0)
    Reward = peewee.IntegerField(default=0)
    AffairStatus = peewee.IntegerField(default=0)
    SignTime = peewee.DateTimeField(default="2010-01-01 00:00:00")
    EndTime = peewee.DateTimeField(default="2010-01-01 00:00:00")


class TbSeat(BaseCharacterModel):
    SeatId = peewee.IntegerField(default=0, primary_key=True)
    RoleGuid = peewee.CharField(max_length=32)
    ServiceRoleGuid = peewee.CharField(max_length=32)


class TbPayRecord(BaseCharacterModel):
    OrderId = peewee.CharField(max_length=32, primary_key=True)
    RoleGuid = peewee.CharField(max_length=32)
    RelationAffairId = peewee.CharField(max_length=32)
    Amount = peewee.IntegerField(default=0)
    OrderStatus = peewee.IntegerField(default=0)
    CreateTime = peewee.DateTimeField(default="2010-01-01 00:00:00")
